﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CamPlug.StaticImage.Plugin
{
	public partial class PropertiesForm : Form
	{
		readonly StaticImagePlugin Plugin;

		public PropertiesForm(StaticImagePlugin plugin)
		{
			this.Plugin = plugin;
			InitializeComponent();
		}

		void UpdateImage()
		{
			TextBoxFileName.Text = Plugin.FileName;
		}

		void ButtonOpenFile_Click(object sender, EventArgs e)
		{
			if (OpenFileDialogImage.ShowDialog() == System.Windows.Forms.DialogResult.OK)
				Plugin.FileName = OpenFileDialogImage.FileName;
			UpdateImage();
		}

		void PropertiesForm_Shown(object sender, EventArgs e)
		{
			Location = Cursor.Position;
			UpdateImage();
		}

		void PropertiesForm_FormClosing(object sender, FormClosingEventArgs e)
		{
			e.Cancel = true;
			Hide();
		}
	}
}
